package com.coder.rental.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author KB
 * @since 2025-04-15
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("busi_order")
@ApiModel(value = "Order对象", description = "")
public class Order implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("订单id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("订单编号")
    private String orderNum;

// | 状态码 | 状态名称 | 状态描述 |
// |--------|----------|----------|
// | 0 | 待支付 | 订单已创建但尚未付款 |
// | 1 | 已支付 | 已完成支付，等待取车 |
// | 2 | 使用中 | 已取车，租赁期间 |
// | 3 | 已完成 | 已还车，交易完成 |
// | 4 | 已取消 | 用户或系统取消订单 |
// | 5 | 待确认 | 还车后等待管理员确认 |
// | 6 | 逾期 | 超过约定还车时间 |
// | 7 | 异常 | 订单存在纠纷或问题 |
    @ApiModelProperty("订单状态")
    private Integer orderStatus;

    @ApiModelProperty("关联车辆id")
    private Integer autoId;

    @ApiModelProperty("客户id")
    private Integer customerId;

    @ApiModelProperty("出租时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime rentalTime;

    @ApiModelProperty("出租类型")
    private Integer typeId;

    @ApiModelProperty("日租金额")
    private Integer rent;

    @ApiModelProperty("押金")
    private Integer deposit;

    @ApiModelProperty("起租里程")
    private Integer mileage;

    @ApiModelProperty("取车时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime pickupTime;

    @ApiModelProperty("归还时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime returnTime;

    @ApiModelProperty("归还里程")
    private Integer returnMileage;

    @ApiModelProperty("应付租金")
    private Integer rentPayable;

    @ApiModelProperty("实付租金")
    private Integer rentActual;

    @ApiModelProperty("押金返还状态 0 未返还  1已返还")
    private Integer depositReturn;

    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @ApiModelProperty("是否删除")
    private Boolean deleted;

    @TableField(exist = false)
    private String customerName;
    @TableField(exist = false)
    private String autoNum;
    @TableField(exist = false)
    private String typeName;
    @TableField(exist = false)
    private String customerTel;
    @TableField(exist = false)
    private Double typeDiscount;
}
